home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / timing2.zip / FNCTICKS.DEF < prev    next >
Text File  |  1989-04-11  |  1KB  |  29 lines

  1. ' def fnCTICKS.def -- returns the number of clock ticks since midnight
  2. '
  3. '       Allows the caller to `mark' the time, with an optional offset
  4. '       ahead in time.  Useful in timing routines
  5. '
  6. ' USAGE:
  7. '       HUN.SCNDS = 100
  8. '       MARK! = FNCTICKS (HUN.SCNDS)  ' # of clock ticks that will
  9. '                    'have occurred since midnite (in 1 sec. from now)
  10. '
  11. 'input: HUN.SCNDS = hundredths of seconds from now
  12. 'output: TIME.MARK! = time marker calculated (clock ticks since midnight)
  13. '
  14. '$INCLUDE: 'qb.bi'
  15. DEF fncticks! (hun.scnds!)
  16.     '$INCLUDE: 'TICKS.def'
  17.     '$DYNAMIC
  18.     DIM Registers AS RegType
  19.     Registers.ax = 0       'set AH (& AL) to 0 to get clock setting
  20.     CALL interrupt(&H1A, Registers, Registers)
  21.     ''CALL int86(&H1A, VARPTR(registers%(0)), VARPTR(registers%(0)))
  22.     cx! = Registers.cx: dx! = Registers.dx
  23.     cticks! = (cx! * 2 ^ 16 + dx!) + (hun.scnds! / 100 * ticks.per.sec!)
  24.     IF cticks! > ticks.per.day! THEN cticks! = cticks! - ticks.per.day!'passed midnite
  25.     fncticks! = FIX(cticks!)
  26. END DEF
  27.  
  28.  
  29.